﻿function Class_User_Menu() { };
Class_User_Menu.prototype.Load = function () {
    var abc;
    var domDocument = top.Class_Dbase.Db_Seal_xml("MenuInfo", "GetInfo");
    var result = top.Class_Dbase.Db_responseText(domDocument);
    domDocument.loadXML(result); return domDocument;
};
Class_User_Menu.prototype.Write = function () {
    var xmlDocument = this.Load();
    if (xmlDocument.text == "")
        return;
    var menu_count = xmlDocument.childNodes[0].childNodes.length;
    var menulist = document.all.Menu_list;
    for (var i = 0; i < menu_count; i++) {
        var gnmkbm = xmlDocument.selectNodes("//NewDataSet/default/gnmkbm")[i].text;
        var gnmkmc = xmlDocument.selectNodes("//NewDataSet/default/gnmkmc")[i].text;
        var gnurl = xmlDocument.selectNodes("//NewDataSet/default/gnurl")[i].text;
        gnurl = 'MenuControl.aspx?id=' + gnmkbm; menulist.innerHTML += "<div id='Menu_" + gnmkbm + "'oncontextmenu='ShowPopMenu_ListInfo(\"" + gnmkmc + "\",\"" + gnurl + "\",\"" + gnmkbm + "\");return false;'" + "style='cursor:pointer'><strong><a href='" + gnurl + "' target='MenuControl'>" + gnmkmc + "</a></strong></div>";
    }
};
function SetMenuCardNew(_obj) {
    var obj = document.getElementById(_obj);
    var Menu_Number = document.getElementById("Menu_Number");
    var count = 0;

    for (var i = 0; i < Menu_Number.childNodes.length; i++) {
        if (Menu_Number.childNodes[i].nodeType == 1) {
            count++;
        }
    }

    if (obj.style.display == "none") {
        obj.style.display = "";
        var index = _obj.replace("menu_", "");
        for (var i = 1; i <= count; i++) {
            var NavBar = document.getElementById("NavBar" + i);
            if (NavBar == null || typeof (NavBar) == "undefined")
                continue; if (i != index) {
                    NavBar.style.display = "none";
                    document.getElementById("menu_" + i).style.display = "none";
                    if (i == 1) {
                        if (index == i + 1) {
                            NavBar.style.display = "";
                            document.getElementById("span_" + i).className = "menucard_First_unchecked";
                        } else {
                            NavBar.style.display = "";
                            document.getElementById("span_" + i).className = "menucard_First_normal";
                        }
                    } else if (i == count) {
                        NavBar.style.display = "";
                        document.getElementById("span_" + i).className = "menucard_Last_unchecked";
                    } else {
                        if (i == index - 1) {
                            NavBar.style.display = "";
                            document.getElementById("span_" + i).className = "menucard_Middle_unchecked";
                        } else {
                            NavBar.style.display = "";
                            document.getElementById("span_" + i).className = "menucard_Middle_normal";
                        }
                    }
                } else {
                if (i == 1) {
                    NavBar.style.display = "";
                    document.getElementById("span_" + i).className = "menucard_First_checked";
                } else if (i == count) {
                    NavBar.style.display = "";
                    document.getElementById("span_" + i).className = "menucard_Last_checked";
                } else {
                    NavBar.style.display = "";
                    document.getElementById("span_" + i).className = "menucard_Middle_checked";
                }
            }
        }
    }
}